home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************
- CDecimalText.h
-
- Interface for CDecimalText class
-
- SUPERCLASS = CDialogText
-
- Copyright © 1993 Michael Abramowicz. All rights reserved.
-
-
- ******************************************************************************/
-
- #pragma once
-
- #include "CDialogText.h"
-
- typedef struct tDecimalTextTemp
- {
- tDialogTextTemp dlgTextTmp;
- long minValue;
- long maxValue;
- long defaultValue;
- short decimalPlaces;
-
- } tDecimalTextTemp, *tDecimalTextTempP;
-
- typedef enum {
- kValid = 1,
- kNonNumeric,
- kNonIntegral,
- kTooManyDecimalPlaces,
- kOutOfRange,
- kOtherReason } Validity;
-
- class CDecimalText : public CDialogText
- {
- public:
-
- void IDecimalText( CView *anEnclosure, CView *aSupervisor,
- short aWidth, short aHeight,
- short aHEncl, short aVEncl,
- SizingOption aHSizing, SizingOption aVSizing,
- short aLineWidth);
-
- virtual void IViewTemp(CView *anEnclosure, CBureaucrat *aSupervisor,
- Ptr viewData);
- void SpecifyDecimalPlaces( short numPlaces, Boolean doValidate);
- short GetDecimalPlaces(void);
- virtual void SpecifyRange( long aMinimum, long aMaximum);
- virtual void SpecifyDefaultValue( long aDefaultValue);
-
- virtual void SetDecValue( double aValue);
- virtual double GetDecValue( void);
-
- virtual void ReportInvalidText( short strIndex);
- virtual Boolean Validate( void);
-
- virtual void DoCommand(long theCommand);
-
- protected:
-
- long minValue; // minimum valid value
- long maxValue; // maximum valid value
- long defaultValue; // default value if text empty. If
- // CDialogText::isRequired is FALSE, then
- // empty text is considered valid and default
- // value is returned by GetIntValue.
- short decimalPlaces; // The maximum number of decimal places that
- // will be displayed.
-
- virtual void ConvertToDecimal( double *decValue, Validity *valid);
- };
-
- // indices into validation error STR# resource for CDecimalText
-
- #define validateNonNumeric 3 // text is non-numeric
- #define validateNonIntegral 4 // text is non-integral
- #define validateDecPlaces 5 // too many decimal places
- #define validateOutOfRange 6 // number is out of rangeΩ
-